<?php

class Country_Widget_VoteRankerController extends Engine_Content_Widget_Abstract
{
  public function indexAction()
  {
    // Don't render this if not authorized
    $viewer = Engine_Api::_()->user()->getViewer();
    $this->view->subject = $subject = Engine_Api::_()->core()->getSubject();
   
    if(!$subject->getIdentity()) {
      return $this->setNoRender();
    }
    $this->view->country = $subject; 
    $voteOptionTable = Engine_Api::_()->getDbtable('voteoptions','country');
    $select = $voteOptionTable->select();
    $this->view->voteOptions  = $voteOptionTable->fetchAll($select);
    /*
    $request = Zend_Controller_Front::getInstance()->getRequest();
    
    $poll_id = 1;
    if (empty($poll_id)) {
         return $this->setNoRender();
    }
    
    $poll = Engine_Api::_()->getItem('country_poll',$poll_id);
    if (empty($poll)) {
         return $this->setNoRender();
    }
    $this->view->poll = $poll;
    
    $pollTable = Engine_Api::_()->getDbtable('polls','country');
    $pollOptions =$pollTable->getOptions($poll_id);
    $this->view->pollOptions = $pollOptions;
    $this->view->country = $subject; 
    */
  }
}